import { ConfigService } from '@nestjs/config'
import { TypeOrmModuleAsyncOptions } from '@nestjs/typeorm'

import { IConfig } from '@/interfaces'

export const TYPEORM_OPTIONS: TypeOrmModuleAsyncOptions = {
  useFactory(configService: ConfigService) {
    return configService.get<IConfig['typeorm']>('typeorm')
  },
  inject: [ConfigService]
}
